# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pmcma
pkgver=1.00
pkgrel=5
groups=('blackarch' 'blackarch-exploitation' 'blackarch-automation'
        'blackarch-fuzzer')
pkgdesc='Automated exploitation of invalid memory writes (being them the consequences of an overflow in a writable section, of a missing format string, integer overflow, variable misuse, or any other type of memory corruption).'
arch=('x86_64' 'aarch64')
url='http://packetstormsecurity.com/files/104724/Post-Memory-Corruption-Memory-Analyzer-1.00.html'
license=('Apache')
depends=('flex' 'bison')
makedepends=('cmake' 'flex' 'bison' 'gcc')
source=("https://dl.packetstormsecurity.net/UNIX/utilities/$pkgname-source-$pkgver.tar.gz")
sha512sums=('5cbba8affe91202878ac50b59b709d0646ad1502ecbda537d3fad5f508a2895eced3eea96d0d8639bcda2473f4e55510659c28c12460366507e699082f6b1291')

build() {
  cd toucan-system-pmcma-374a319

  cd beaengine/ && :>CMakeCache.txt && cmake . && make
  cd ..
  make
}

package() {
  cd toucan-system-pmcma-374a319

  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 755 pmcma "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 pmcma.1 "$pkgdir/usr/share/man/man1/pmcma.1"
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" AUTHORS CHANGELOG README\
    README.ubuntu TODO COMPILING NOTICE

  cp doc/* "$pkgdir/usr/share/doc/$pkgname/"
}

